package com.yima.baseproj.module.app.equipmentEquipment;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yima.baseproj.module.app.equipmentEquipment.model.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
public class EquipmentEquipmentService extends ServiceImpl<EquipmentEquipmentMapper, EquipmentEquipmentEntity> {

    public Page<Map> findByPage(Page page, EquipmentEquipmentSearchModel searchVo) {
        return baseMapper.findBySearchVo(page,searchVo);
    }

    public List<Map> findByList(EquipmentEquipmentSearchModel searchVo) {
        return baseMapper.findBySearchVo(searchVo);
    }

    /**
     * 添加 - 事务
     * @param paramModel
     */
    @Transactional(rollbackFor = Exception.class)
    public void add(EquipmentEquipmentAddParamModel paramModel) {

    }

    @Transactional(rollbackFor = Exception.class)
    public void edit(EquipmentEquipmentEditParamModel paramModel) {

    }

    @Transactional(rollbackFor = Exception.class)
    public void dels(String[] ids) {
        baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    public void deleteById(String id) {
        baseMapper.deleteById(id);
    }


    public List<EquipmentEquipmentEntity> selectList(String userOpenid) {

        return baseMapper.selectList(userOpenid);
    }

    public int getOneList(String deviceNo) {

        return baseMapper.getOneList(deviceNo);
    }


    public boolean delNO(String deviceNo) {
        return baseMapper.delNO(deviceNo);
    }

    public EquipmentEquipmentEntity getOneL(String deviceNo) {
        return baseMapper.getOneL(deviceNo);
    }
}